﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Ch12.Models
{
    /// <summary>
    /// 分户资料
    /// </summary>
    [Table("House")]
    public class House : EntitySet
    {
        /// <summary>
        /// 所属楼栋
        /// </summary>
        [Required]
        [MaxLength(36)]
        public string BuildingId { get; set; }
        /// <summary>
        /// 房号
        /// </summary>
        [Required]
        [MaxLength(36)]
        public string Name { get; set; }
        /// <summary>
        /// 位置
        /// </summary>
        [MaxLength(256)]
        public string Position { get; set; }
        /// <summary>
        /// 单元
        /// </summary>
        [Required]
        [DefaultValue(0)]
        public int Unit { get; set; }
        /// <summary>
        /// 层
        /// </summary>
        [Required]
        [DefaultValue(0)]
        public int Floor { get; set; }
        /// <summary>
        /// 房本编号
        /// </summary>
        [MaxLength(36)]
        public string HousePropertyCertificateNumber { get; set; }
        /// <summary>
        /// 分户类型
        /// </summary>
        [DefaultValue(HouseTypes.NaturalHouse)]
        public HouseTypes HouseType { get; set; }
        /// <summary>
        /// 房屋结构
        /// </summary>
        [DefaultValue(HousingStructures.None)]
        public HousingStructures HousingStructure { get; set; }
        /// <summary>
        /// 房屋用途
        /// </summary>
        [DefaultValue(HouseProperties.None)]
        public HouseProperties HouseProperty { get; set; }
        /// <summary>
        /// 缴费标准
        /// </summary>
        [DefaultValue(0)]
        public decimal PaymentStandard { get; set; }
        /// <summary>
        /// 建筑面积
        /// </summary>
        [DefaultValue(0)]
        public decimal BuiltupArea { get; set; }
        /// <summary>
        /// 是否包含于总面积
        /// 用于统计虚拟的物管用房面积
        /// 用于计算应确权面积, 除物业用房以外的面积
        /// 小区的应确权面积为下属所有非物业楼幢的建筑面积总和
        /// </summary>
        [DefaultValue(true)]
        public bool IncludedInTotalArea { get; set; }
        ///// <summary>
        ///// 售价
        ///// </summary>
        //[Precision(18, 4)]
        //public decimal? SalePrice { get; set; }
        ///// <summary>
        ///// 出售日期
        ///// </summary>
        //public DateTime? SaleDate { get; set; }
        /// <summary>
        /// 业主
        /// </summary>
        [MaxLength(36)]
        public string ProprietorId { get; set; }
        /// <summary>
        /// 账户
        /// </summary>
        [MaxLength(36)]
        public string AccountId { get; set; }
        /// <summary>
        /// 业务类型
        /// </summary>
        [DefaultValue(BusinessTypes.None)]
        public BusinessTypes BusinessType { get; set; }
        /// <summary>
        /// 当前业务处于的状态, 可由审核过程而来
        /// </summary>
        [DefaultValue(BusinessStates.None)]
        public BusinessStates BusinessState { get; set; }
        /// <summary>
        /// 是否已确认
        /// </summary>
        [DefaultValue(false)]
        public bool HasConfirmed { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(256)]
        public string Remarks { get; set; }

        /// <summary>
        /// 业主信息
        /// </summary>
        public virtual Proprietor Proprietor { get; set; }
        /// <summary>
        /// 资金账户信息
        /// </summary>
        public virtual Account Account { get; set; }
    }
}